#include <iostream>
#include <thread>

#include "SingletonPattern.h"

void DangerSingleton()
{
    auto func = []()
    {
        if (SingletonLazyUnsafe::getInstance() != nullptr)
        {
            SingletonLazyUnsafe::getInstance()->print();
        }
    };

    std::jthread t1{func};
    std::jthread t2{func};
    std::cout << "Construct counts: " << SingletonLazyUnsafe::getInstance()->s_nConstructCount.load()
              << std::endl; // 构建了两次

}


int main()
{
   DangerSingleton();

    return 0;
}